<%-- 
    Document   : results_flights_right
    Created on : 2008-10-26, 15:56:12
    Author     : Tracy
--%>

<%@ page language="java" import="java.util.*,common.*,flight.*" pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">

    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <style type="text/css">
<!--
.STYLE1 {
	font-size: 18px;
	font-weight: bold;
}
.STYLE2 {
	font-size: x-large;
	font-weight: bold;
}
body {
	background-image: url(images/back3.jpg);
}
.style3 {color: #FFFFFF}
-->
    </style>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>

    <script language="JavaScript">
    function PopIt(label, msg){
        // Set up Page Colors & Table
        var s1 = "<TITLE>Information!</TITLE>" +
                  "<BODY BGCOLOR='ffffff'><TABLE BORDER=0><TR>" +
                  "<TD WIDTH=90% HEIGHT=90 VALIGN=TOP ALIGN=LEFT>"+
                  "<FONT SIZE=4>"
        var s2 = "<FONT COLOR='FF0000'><B>"+label+"</B></FONT><P>"
        var s3 = "</TD><TD WIDTH=10%> </TD></TR><TR><TD> </TD>"+
                  "<TD VALIGN=TOP ALIGN=RIGHT>"+
                  "<FORM><INPUT TYPE='BUTTON' VALUE='Okay'" +
                  "onClick='self.close()'>"  +
                  "</FORM></TD></TR></TABLE></BODY>"
        var iw=320;
        var ih=200;
        var itop=(window.screen.height-ih)/2;
        var ileft=(window.screen.width-iw)/2;
        popup = window.open('','popDialog',"scrollbars=no,toolbar=no,location=no,direction=no,resizeable=no,width="+iw+",height="+ih+",top="+itop+",left="+ileft);
        popup.document.write(s1+s2+msg+s3)
        //popup.resizeTo(200,200);
        popup.document.close()
    }

    function popHelp(){
        PopIt('PopIt','This function allows you to create a popup window.')
    }
    </script>

    <script language="javascript">
    var opop=window.createPopup();
    function ButtonClick(msg)
    {
        var opopbody=opop.document.body;
        opopbody.style.backgroundColor="#ffffae";
        opopbody.style.border="solid black 1px";
        opopbody.innerHTML=msg;
        opop.show((window.screen.width-300-250),200,400,700,document.body);
    }
    </script>

  <body>
      
  <center>
      <form name="submit_selected" method="post" action="/afirs/FlightSelect/FlightSelectServlet">
      <p class="STYLE2">Search Results</p>
      <table align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="5" width=91%>
      <%
	PageBean pageCtl = (PageBean)request.getAttribute("pageCtl");
        FlightBean fb = (FlightBean)request.getAttribute("fb");
  	java.util.Vector v = pageCtl.getResult();
  	java.util.Enumeration e = v.elements();
        int cnt = 0;

        String searchCriteria = fb.getSearchCriteria();
      %>
      <tr bgcolor="#cc99cc">
        <td colspan="11" bgcolor="#FFFFFF"><%=searchCriteria%></td>
        </tr>
      <tr bgcolor="#cc99cc">
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Choose</P></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Depart City</P></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Arrive City</P></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Trip Type</P></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Airline Name</P></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Flight Number</P></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Departure Date</P></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Arrival Date</P></td>
       <td bgcolor="#66CCFF" class="STYLE1"><p align="center">Total Cost</p></td>
       <td bgcolor="#66CCFF"><p align="center"><strong>Total Miles</strong></p></td>
       <td bgcolor="#66CCFF"><P align="center" class="STYLE1">Detail</P></td>
      </tr>
        <%
  	while(e.hasMoreElements())
	{
            Object[] obj = (Object[])e.nextElement();
            String type = (String)obj[0];
            String str = (String)obj[7];
        %>
            <tr bgcolor="#CCFFFF">
            <td align="center" width="58"><input type="radio" name="choose_flight" value=<%=obj[8]%> >
                <input type="hidden" value="0" name="reset" /></td>
            <td align="center" width="124"><%=obj[1]%></td>
            <td align="center" width="122"><%=obj[2]%></td>
            <td align="center" width="89">
<% if(type.equals("1")){ %>
                  Non-Stop
              <% } else if(type.equals("2")){ %>
                  1-Stop
              <% } else if(type.equals("3")){ %>
                  2-Stop
              <% } else if(type.equals("4")){ %>
                  3-Stop
              <% } else if(type.equals("5")){ %>
                  4-Stop
              <% } %>            </td>
            <td width="123"><%=obj[3]%></td>
            <td width="117"><%=obj[4]%></td>
            <td align="center" width="136"><%=obj[5]%></td>
            <td align="center" width="120"><%=obj[6]%></td>
            <td align="center" width="65"><%=obj[10]%></td>
            <td align="center" width="62"><%=obj[9]%></td>
            <td align="center" width="68"><input type="button" value="Detail" onClick="javascript:ButtonClick('<%=str%>')"></td>
        </tr>
<%
            cnt++;
	}
        
        session.setAttribute("fb",fb);
%>
<td> <input type="submit" name="submitID" value="Select"> </td>

</table>
      <br>
    </form>
<% if(pageCtl.maxPage!=1) { %>
<form name="PageForm" action="/afirs/flight/FlightSearchPageServlet" method="post">
    <%@include file="pageman.jsp"%>
</form>
<p>
<% } %>
</p>
<p>----------&gt;  <strong><a href="../afirs/index.jsp">Search Again</a></strong> &lt;----------</p>
  </center>
</body>
</html>